import 'package:kasax_demos2/entry/movie_new_info_entity.dart';

movieNewInfoEntityFromJson(MovieNewInfoEntity data, Map<String, dynamic> json) {
	if (json['count'] != null) {
		data.count = json['count'] is String
				? int.tryParse(json['count'])
				: json['count'].toInt();
	}
	if (json['start'] != null) {
		data.start = json['start'] is String
				? int.tryParse(json['start'])
				: json['start'].toInt();
	}
	if (json['total'] != null) {
		data.total = json['total'] is String
				? int.tryParse(json['total'])
				: json['total'].toInt();
	}
	if (json['subjects'] != null) {
		data.subjects = (json['subjects'] as List).map((v) => MovieNewInfoSubjects().fromJson(v)).toList();
	}
	if (json['title'] != null) {
		data.title = json['title'].toString();
	}
	return data;
}

Map<String, dynamic> movieNewInfoEntityToJson(MovieNewInfoEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['count'] = entity.count;
	data['start'] = entity.start;
	data['total'] = entity.total;
	data['subjects'] =  entity.subjects.map((v) => v.toJson()).toList();
	data['title'] = entity.title;
	return data;
}

movieNewInfoSubjectsFromJson(MovieNewInfoSubjects data, Map<String, dynamic> json) {
	if (json['rating'] != null) {
		data.rating = MovieNewInfoSubjectsRating().fromJson(json['rating']);
	}
	if (json['genres'] != null) {
		data.genres = (json['genres'] as List).map((v) => v.toString()).toList().cast<String>();
	}
	if (json['title'] != null) {
		data.title = json['title'].toString();
	}
	if (json['casts'] != null) {
		data.casts = (json['casts'] as List).map((v) => MovieNewInfoSubjectsCasts().fromJson(v)).toList();
	}
	if (json['collect_count'] != null) {
		data.collectCount = json['collect_count'] is String
				? int.tryParse(json['collect_count'])
				: json['collect_count'].toInt();
	}
	if (json['original_title'] != null) {
		data.originalTitle = json['original_title'].toString();
	}
	if (json['subtype'] != null) {
		data.subtype = json['subtype'].toString();
	}
	if (json['directors'] != null) {
		data.directors = (json['directors'] as List).map((v) => MovieNewInfoSubjectsDirectors().fromJson(v)).toList();
	}
	if (json['year'] != null) {
		data.year = json['year'].toString();
	}
	if (json['images'] != null) {
		data.images = MovieNewInfoSubjectsImages().fromJson(json['images']);
	}
	if (json['alt'] != null) {
		data.alt = json['alt'].toString();
	}
	if (json['id'] != null) {
		data.id = json['id'].toString();
	}
	return data;
}

Map<String, dynamic> movieNewInfoSubjectsToJson(MovieNewInfoSubjects entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['rating'] = entity.rating.toJson();
	data['genres'] = entity.genres;
	data['title'] = entity.title;
	data['casts'] =  entity.casts.map((v) => v.toJson()).toList();
	data['collect_count'] = entity.collectCount;
	data['original_title'] = entity.originalTitle;
	data['subtype'] = entity.subtype;
	data['directors'] =  entity.directors.map((v) => v.toJson()).toList();
	data['year'] = entity.year;
	data['images'] = entity.images.toJson();
	data['alt'] = entity.alt;
	data['id'] = entity.id;
	return data;
}

movieNewInfoSubjectsRatingFromJson(MovieNewInfoSubjectsRating data, Map<String, dynamic> json) {
	if (json['max'] != null) {
		data.max = json['max'] is String
				? int.tryParse(json['max'])
				: json['max'].toInt();
	}
	if (json['average'] != null) {
		data.average = json['average'] is String
				? double.tryParse(json['average'])
				: json['average'].toDouble();
	}
	if (json['stars'] != null) {
		data.stars = json['stars'].toString();
	}
	if (json['min'] != null) {
		data.min = json['min'] is String
				? int.tryParse(json['min'])
				: json['min'].toInt();
	}
	return data;
}

Map<String, dynamic> movieNewInfoSubjectsRatingToJson(MovieNewInfoSubjectsRating entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['max'] = entity.max;
	data['average'] = entity.average;
	data['stars'] = entity.stars;
	data['min'] = entity.min;
	return data;
}

movieNewInfoSubjectsCastsFromJson(MovieNewInfoSubjectsCasts data, Map<String, dynamic> json) {
	if (json['alt'] != null) {
		data.alt = json['alt'].toString();
	}
	if (json['avatars'] != null) {
		data.avatars = MovieNewInfoSubjectsCastsAvatars().fromJson(json['avatars']);
	}
	if (json['name'] != null) {
		data.name = json['name'].toString();
	}
	if (json['id'] != null) {
		data.id = json['id'].toString();
	}
	return data;
}

Map<String, dynamic> movieNewInfoSubjectsCastsToJson(MovieNewInfoSubjectsCasts entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['alt'] = entity.alt;
	data['avatars'] = entity.avatars.toJson();
	data['name'] = entity.name;
	data['id'] = entity.id;
	return data;
}

movieNewInfoSubjectsCastsAvatarsFromJson(MovieNewInfoSubjectsCastsAvatars data, Map<String, dynamic> json) {
	if (json['small'] != null) {
		data.small = json['small'].toString();
	}
	if (json['large'] != null) {
		data.large = json['large'].toString();
	}
	if (json['medium'] != null) {
		data.medium = json['medium'].toString();
	}
	return data;
}

Map<String, dynamic> movieNewInfoSubjectsCastsAvatarsToJson(MovieNewInfoSubjectsCastsAvatars entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['small'] = entity.small;
	data['large'] = entity.large;
	data['medium'] = entity.medium;
	return data;
}

movieNewInfoSubjectsDirectorsFromJson(MovieNewInfoSubjectsDirectors data, Map<String, dynamic> json) {
	if (json['alt'] != null) {
		data.alt = json['alt'].toString();
	}
	if (json['avatars'] != null) {
		data.avatars = MovieNewInfoSubjectsDirectorsAvatars().fromJson(json['avatars']);
	}
	if (json['name'] != null) {
		data.name = json['name'].toString();
	}
	if (json['id'] != null) {
		data.id = json['id'].toString();
	}
	return data;
}

Map<String, dynamic> movieNewInfoSubjectsDirectorsToJson(MovieNewInfoSubjectsDirectors entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['alt'] = entity.alt;
	data['avatars'] = entity.avatars.toJson();
	data['name'] = entity.name;
	data['id'] = entity.id;
	return data;
}

movieNewInfoSubjectsDirectorsAvatarsFromJson(MovieNewInfoSubjectsDirectorsAvatars data, Map<String, dynamic> json) {
	if (json['small'] != null) {
		data.small = json['small'].toString();
	}
	if (json['large'] != null) {
		data.large = json['large'].toString();
	}
	if (json['medium'] != null) {
		data.medium = json['medium'].toString();
	}
	return data;
}

Map<String, dynamic> movieNewInfoSubjectsDirectorsAvatarsToJson(MovieNewInfoSubjectsDirectorsAvatars entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['small'] = entity.small;
	data['large'] = entity.large;
	data['medium'] = entity.medium;
	return data;
}

movieNewInfoSubjectsImagesFromJson(MovieNewInfoSubjectsImages data, Map<String, dynamic> json) {
	if (json['small'] != null) {
		data.small = json['small'].toString();
	}
	if (json['large'] != null) {
		data.large = json['large'].toString();
	}
	if (json['medium'] != null) {
		data.medium = json['medium'].toString();
	}
	return data;
}

Map<String, dynamic> movieNewInfoSubjectsImagesToJson(MovieNewInfoSubjectsImages entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['small'] = entity.small;
	data['large'] = entity.large;
	data['medium'] = entity.medium;
	return data;
}